<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>编辑市场信息-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .w50 {
            width: 50px;
        }
    </style>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">联系人管理 > 编辑市场信息</div>
    </div>
    <div id="content">
        <form action="__APP__/Crm/market_edit" method="post" id="market_edit_form">
            <input name="information_id", value="{$information_id}" type="hidden">
            <div class="form-main">
                <div class="form-title">编辑市场信息</div>
				<div class="form-item">
					<div class="input-label"><span class="asterisk">*</span>信息名称</div>
					<div class="input-item" style="position:relative;">
						<input type="text" name="customer_name" class="form-control required-text w300" autocomplete="off" value="{$result['customer_name']}">
						<span class="error-item">必填项</span>
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">信息简称</div>
					<div class="input-item" style="position:relative;">
						<input type="text" name="short_name" class="form-control w200" autocomplete="off" value="{$result['short_name']}">
					</div>
				</div>
				<div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>获悉渠道</div>
                    <div class="input-item">
                        <select name="channel" class="form-control w250 required_select" autocomplete="off">
							<foreach name="channel" item="vo">
                                <option value="{$vo['id']}" <if condition="$result['channel'] eq $vo['id']">selected</if>>{$vo['name']}</option>
                            </foreach>
                        </select>
						<span class="error-item">必填项</span>
                    </div>
                </div>
				<div class="form-item clearfix">
					<div class="item-float" style="width:20%">
						<div class="input-label">推荐人</div>
						<div class="input-item">
							<input type="text" name="link_user" class="form-control w200" autocomplete="off" value="{$result['link_user']}">
						</div>
					</div>
					<div class="item-float" style="width:20%">
						<div class="input-label">推荐人联系电话</div>
						<div class="input-item">
							<input type="text" name="link_mobilephone" class="form-control w200" autocomplete="off" value="{$result['link_mobilephone']}">
							<span class="error-item"></span>
						</div>
					</div>
				</div>
				<div class="form-item clearfix">
					<div class="item-float" colspan="2">
						<div class="input-label">备注</div>
						<div class="input-item">
							<textarea name="remark" class="form-control w500 h150" autocomplete="off">{$result['remark']}</textarea>
						</div>
					</div>
				</div>
            </div>
            <p class="red Text_c bili_item hide"></p>
            <div class="form-btn-item"><input type="submit" value="提交" class="btn btn-submit">
                <button class="btn btn-default goback" type="button">返回</button>
            </div>
        </form>
    </div>
</div>
</body>
<include file="Include:javascript"/>
<script type="text/javascript">
    $(function () {
        /*表单验证*/
        $(".btn-submit").click(function () {
            var tag = false;
			//必填判断
            $('.required-text').each(function () {
                var val = $(this).val();
                if (val == '') {
                    $(this).next('.error-item').show();
                    tag = true;
                }
            })
			//必选判断
            $('.required_select').each(function () {
                var val = $(this).val();
                if (val == 0) {
                    $(this).siblings('.error-item').show();
                    tag = true;
                }
            })
			$("[name='link_mobilephone']").each(function(){
				var $val = $(this).val();
				if($val!="" && !/^1[3|4|5|7|8]\d{9}$/.test($val)){
					$(this).next(".error-item").html("输入正确的手机格式").show();
					tag = true;
				}
			});
            if (tag) {
                return false;
            }
        });

        /*取消错误提示*/
        $('.required_select').change(function () {
            $(this).siblings('.error-item').hide();
        });
        $(".required-text").focus(function () {
            $(this).nextAll('.error-item').hide();
        });
    });
</script>
</html>